package org.tp8.sampleapp.rule.model;

import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * The Class RuleResult.
 * 
 * the generic type
 */
@XmlRootElement(name = "ruleModelWrapper")
@XmlAccessorType(XmlAccessType.FIELD)
public class RuleModelWrapper {

	/** The model. */
	@XmlTransient
	private Object model;

	/** The error code. */
	@XmlElementWrapper(name = "errorCodes")
	@XmlElement(name = "errorCode")
	private List<String> errorCodes;

	/**
	 * Gets the model.
	 * 
	 * @return the model
	 */
	public Object getModel() {
		return model;
	}

	/**
	 * Sets the model.
	 * 
	 * @param model
	 *            the model to set
	 */
	public void setModel(Object model) {
		this.model = model;
	}

	/**
	 * Gets the valid.
	 * 
	 * @return the valid
	 */
	public Boolean getValid() {
		return errorCodes.isEmpty();
	}

	/**
	 * Gets the error code.
	 * 
	 * @return the errorCode
	 */
	public List<String> getErrorCodes() {
		if (errorCodes == null) {
			errorCodes = new java.util.LinkedList<String>();
		}
		return errorCodes;
	}

	/**
	 * Sets the error code.
	 * 
	 * @param errorCode
	 *            the errorCode to set
	 */
	public void setErrorCodes(List<String> errorCodes) {
		this.errorCodes = errorCodes;
	}

}
